package com.egdd.video.service.iml;

import com.egdd.video.mapper.CategoryMapper;
import com.egdd.video.pojo.Category;
import com.egdd.video.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CategoryServiceImpl implements ICategoryService {
    @Autowired(required = false)
    private CategoryMapper categoryMapper;
    @Override
    public List<Category> getAllCategory() {
        return categoryMapper.getAll();
    }

    @Override
    public int addCategory(Category category) {
       return categoryMapper.insert(category);
    }

    @Override
    public void delCategoryById(Integer id) {
        categoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<Category> getCategoryRec() {
        return null;
    }

    @Override
    public int updateCategory(Integer id, Category category) {
        category.setId(id);
        return categoryMapper.updateByPrimaryKey(category);
    }
}
